1 // Fetch a URL. Record the time. Return a result object.
2
3 import java.io.*;
4 import java.net.*;
5 import java.util.*;
6
7 public class FetchResult {
8
9 public long time;
10 public int status;
11 public int size;
12 public String httpStatus;
13
14 public static final int FR_OK = 1;
15 public static final int FR_CONNECT_FAILED = 2;
16 public static final int FR_READ_FAILED = 3;
17 public static final int FR_UNKNOWN_ERROR = 99;
18
19 public FetchResult() {
20 time = 0;
21 size = 0;
22 }
23
24 public void start() {
25
26 Date d = new Date();
27 time = d.getTime();
28 }
29
30 public void end() {
31 Date d = new Date();
32 time = d.getTime() - time;
33 }
34 }
|